import socket

sock = socket.socket()

sock.bind(('127.0.0.1', 9090))
sock.listen(5)
while True:
    conn, addr = sock.accept()
    print(f'Connected by {addr}')
    while True:
        data = conn.recv(1024)
        if not data:
            break
        print(f'Received {data}')
        # conn.send(data)
        conn.send(b'HTTP/1.1 200 ok\r\nserver:yuan\r\ncontent-type:application-json\r\n\r\n{"username": "AKW"}')
        break
    conn.close()
